package com.ruoyi.shop.member.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.shop.member.mapper.ShopConfigSignMapper;
import com.ruoyi.shop.member.service.IShopConfigSignService;
import com.ruoyi.shop.member.vo.ShopConfigSignVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 商城签到配置Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-22
 */
@Service
public class ShopConfigSignServiceImpl implements IShopConfigSignService {
	@Autowired
	private ShopConfigSignMapper shopConfigSignMapper;

	/**
	 * 查询商城签到配置
	 * 
	 * @param configId 商城签到配置主键
	 * @return 商城签到配置
	 */
	@Override
	public ShopConfigSignVo selectConfigById(Long configId) {
		return shopConfigSignMapper.selectConfigById(configId);
	}

	/**
	 * 根据连续签到天数查询配置
	 * 
	 * @param dayNum
	 * @return
	 */
	@Override
	public ShopConfigSignVo selectConfigByDayNum(Integer dayNum) {
		return shopConfigSignMapper.selectConfigByDayNum(dayNum);
	}

	/**
	 * 查询商城签到配置列表
	 * 
	 * @param shopConfigSign 商城签到配置
	 * @return 商城签到配置
	 */
	@Override
	public List<ShopConfigSignVo> selectConfigList() {
		return shopConfigSignMapper.selectConfigList();
	}

	/**
	 * 新增商城签到配置
	 * 
	 * @param shopConfigSign 商城签到配置
	 * @return 结果
	 */
	@Override
	public int insertConfig(ShopConfigSignVo shopConfigSign) {
		shopConfigSign.setCreateTime(DateUtils.getNowDate());
		return shopConfigSignMapper.insertConfig(shopConfigSign);
	}

	/**
	 * 修改商城签到配置
	 * 
	 * @param shopConfigSign 商城签到配置
	 * @return 结果
	 */
	@Override
	public int updateConfig(ShopConfigSignVo shopConfigSign) {
		shopConfigSign.setUpdateTime(DateUtils.getNowDate());
		return shopConfigSignMapper.updateConfig(shopConfigSign);
	}

	/**
	 * 删除商城签到配置
	 * 
	 * @param configId 需要删除的商城签到配置主键
	 * @return 结果
	 */
	@Override
	public int deleteByConfigId(Long configId) {
		return shopConfigSignMapper.deleteByConfigId(configId);
	}

}
